package com.app.service.impl;

import com.app.mapper.akesai.*;
import com.app.mapper.dunhuang.*;
import com.app.mapper.guazhou.*;
import com.app.mapper.jinta.*;
import com.app.mapper.subei.*;
import com.app.mapper.suzhou.*;
import com.app.mapper.yumen.*;
import com.app.model.*;
import com.app.service.StatisticsService;
import com.app.service.YouthJobInvestigateService;
import com.app.util.StringTool;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class YouthJobInvestigateServiceImpl implements YouthJobInvestigateService {
    @Autowired
    YouthJobInvestigateMapper youthJobInvestigateMapper;


    @Override
    public Integer getCount(String field, String value) {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper1 = new QueryWrapper<>();
        if(StringTool.isNotEmpty(field))
        {
            queryWrapper1.like(field, value);
        }
        Integer count1 = youthJobInvestigateMapper.selectCount(queryWrapper1);
        return count1;
    }

    @Override
    public Integer getWagesSum() {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("sum(wages) as wagesAll");
        YouthJobInvestigateModel model = new YouthJobInvestigateModel();
        model = youthJobInvestigateMapper.selectOne(queryWrapper);
        if(model!=null)
        {
            return model.getWagesAll();
        }else{
            return 0;
        }

    }

    @Override
    public Integer getWorkTimeSum() {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("sum(recent_work_time) as workTimeAll");
        YouthJobInvestigateModel model = new YouthJobInvestigateModel();
        model = youthJobInvestigateMapper.selectOne(queryWrapper);
        if(model!=null)
        {
            return model.getWorkTimeAll();
        }else{
            return 0;
        }
    }

    @Override
    public Integer getWorkAvg() {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("avg(wages) as workTimeAll");
        YouthJobInvestigateModel model = new YouthJobInvestigateModel();
        model = youthJobInvestigateMapper.selectOne(queryWrapper);
        if(model!=null)
        {
            return model.getWorkTimeAll();
        }else{
            return 0;
        }
    }

    @Override
    public Integer getNotWorkThan(String key,String value) {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper1 = new QueryWrapper<>();
        if(StringTool.isNotEmpty(value))
        {
            queryWrapper1.like(key, value);
        }
        queryWrapper1.like("recent_work_situation", "没有上述情形");
        Integer count1 = youthJobInvestigateMapper.selectCount(queryWrapper1);
        return count1;
    }

    @Override
    public Integer geModelCount(String identity,String value) {
        QueryWrapper<YouthJobInvestigateModel> queryWrapper1 = new QueryWrapper<>();
        if(StringTool.isNotEmpty(identity))
        {
            queryWrapper1.like(identity, value);
        }
        queryWrapper1.notLike("graduation_time", "2024");
        queryWrapper1.notLike("graduation_time", "2025");
        Integer count1 = youthJobInvestigateMapper.selectCount(queryWrapper1);
        return count1;
    }
}
